home *** CD-ROM | disk | FTP | other *** search
/ PC Media 2 / PC MEDIA CD02.iso / share / prog / realasm1 / itoft.asm < prev    next >
Encoding:
Assembly Source File  |  1993-07-18  |  1.1 KB  |  41 lines

  1. .286
  2. ;================================================
  3. ; convert signed integer to a REAL10
  4. ;
  5. ;------------------------------------------------
  6. cseg          segment word public 'code'
  7.               assume  cs:cseg,ss:cseg
  8.               assume  ds:cseg,es:cseg
  9.  
  10.               include math.inc
  11.  
  12. itoft         proc    near  uses ax si, real:NPR10, integer:SWORD
  13.  
  14.               mov     si, real
  15.  
  16.               .IF (integer < 0)
  17.               mov     word ptr [si]+8, 8000h
  18.               neg     integer
  19.               .ELSE
  20.               mov     word ptr [si]+8, 0
  21.               .ENDIF
  22.  
  23.               invoke  clrx, si, 4
  24.               mov     ax, integer
  25.  
  26.               .IF (ax)
  27.                  add     word ptr [si]+8, (3fffh + 15)
  28.                  .WHILE (1)
  29.                     .BREAK .IF (ax & 8000h)
  30.                     dec     word ptr [si]+8
  31.                     shl     ax, 1
  32.                  .ENDW
  33.                  mov     word ptr [si]+6, ax
  34.               .ENDIF
  35.  
  36.               ret
  37. itoft         endp
  38.  
  39. cseg          ends
  40.               end
  41.